<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>元素消失方式</title>
</head>
<style>
    div{
        width: 200px;
        height: 200px;
    }
    .d1,.d4{
        background-color: red;
    }
    .d1:hover{
        transform: scale(0); /*缩小到看不见，不释放布局空间*/
    }
    .d2{
        background-color: yellow;
    }
    .d2:hover{
       display: none;/*修改显示模式，释放布局空间*/
    }
    .d3{
        background-color: blue;
    }
    .d3:hover{
        /*background-color: rgba(0,0,0,0); 不推荐 只能改变背景色 边框无法消失*/
        opacity: 0;
    }
</style>
<body>
    <div class="d1"></div>
    <div class="d2"></div>
    <div class="d3"></div>
    <div class="d4"></div>
</body>
</html>